﻿using System;
using System.Collections.Generic;
using System.Text;
using ArkEC.CoreCom.CacheStore;
using System.Data.Common;
using System.Data;
using ArkEC.SEMs.DataAccess;
using ArkEC.SEMs.DataAccess.MLM;

namespace ArkEC.SEMs.Business.MLM
{
    /// <summary>
    /// 语言种类缓存
    /// </summary>
    public class LanTypeCache : CacheType
    {
        /// <summary>
        /// 
        /// </summary>
        private static string _CacheNameField = "LanType";

        #region 构造函数

        /// <summary>
        /// 唯一实例
        /// </summary>
        private static LanTypeCache mInstance = new LanTypeCache();
        public static LanTypeCache Instance
        {
            get 
            {
                return mInstance; 
            }
        }

        /// <summary>
        /// 构造函数
        /// </summary>
        private LanTypeCache() 
        {
            this.CacheName = _CacheNameField;
        }

        #endregion

        /// <summary>
        /// 读取缓存数据
        /// </summary>
        /// <returns></returns>
        public override Dictionary<string, object> ReadCache()
        {
            Dictionary<string, object> lanTypes = new Dictionary<string, object>();
            DataTable lanTypeTable = null;
            using (DbConnection conn = ConnFactory.CreateConn())
            {
                lanTypeTable = MLMDAFactory.CreateLanTypeDA().GetLanTypes(conn, null);
            }

            lanTypes.Add("Default", lanTypeTable);

            return lanTypes;
        }
    }
}
